"use strict";
cc._RF.push(module, '9107cxvQh5IZ7rvzJbNRo8J', 'tile');
// Script/game/obj/tile.ts

/*
 * @Author: llch
 * @Date: 2020-08-05 15:22:31
 * @LastEditTime: 2020-08-12 10:52:28
 * @LastEditors: Please set LastEditors
 * @Description: 格子对象
 * @FilePath: \shici_demo\assets\Script\game\obj\tile.ts
 */
Object.defineProperty(exports, "__esModule", { value: true });
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var Tile = /** @class */ (function (_super) {
    __extends(Tile, _super);
    function Tile() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.tileId = undefined; // 格子id
        _this.isUsed = false; // 格子使用状态     筛选棋盘中显示的棋子
        _this.char = undefined; // 格子上的字符
        _this.data = []; // 格子上保存的词语，诗句对象
        _this.isSpace = false; // 格子是否为 去 字状态      为true表明 这个位置 是空位
        _this.hasWord = false; // 空位格子上是否有 字
        _this.isSucceed = false; // 格子填词是否正确
        _this.idioms = undefined; // 成语对象数组
        _this.poem = undefined; // 诗词对象
        _this.currentId = undefined; // 当前上挂载的词id
        _this.bgSprite = null;
        _this.wordLabel = null;
        _this.tile_bg = null;
        _this.tile_bg_normal = null;
        _this.tile_bg_selected = null;
        _this.tile_bg_success = null;
        _this.tile_bg_normal2 = null;
        _this.tile_select_bg = null;
        return _this;
    }
    // 还原
    Tile.prototype.restTile = function () {
        this.isUsed = false;
        this.char = "";
        this.data = [];
        this.idioms = undefined;
        this.poem = undefined;
        this.isSpace = false;
        this.isSucceed = false;
        this.currentId = undefined;
        this.hasWord = false;
        this.bgSprite.spriteFrame = this.tile_bg;
        this.wordLabel.string = "";
        this.node.opacity = 0;
    };
    // 设置
    Tile.prototype.setTile = function (isUsed, char, data) {
        this.isUsed = isUsed;
        this.char = char;
        if (data) {
            this.data = data;
        }
        this.node.opacity = 255;
    };
    // 修改bg
    /**
     * @description:
     * @param {number} 0 tile_bg, 1 tile_bg_normal, 2 tile_bg_selected, 3 tile_select_bg, 4 tile_bg_success, 5 tile_bg_normal2
     * @return {type}
     */
    Tile.prototype.setBgSprite = function (num) {
        switch (num) {
            case -1:
                this.bgSprite.spriteFrame = null;
                break;
            case 0:
                this.bgSprite.spriteFrame = this.tile_bg;
                break;
            case 1:
                this.bgSprite.spriteFrame = this.tile_bg_normal;
                break;
            case 2:
                this.bgSprite.spriteFrame = this.tile_bg_selected;
                break;
            case 3:
                this.bgSprite.spriteFrame = this.tile_select_bg;
                break;
            case 4:
                this.bgSprite.spriteFrame = this.tile_bg_success;
                break;
            case 5:
                this.bgSprite.spriteFrame = this.tile_bg_normal2;
                break;
            default:
                this.bgSprite.spriteFrame = this.tile_bg;
        }
    };
    // 修改charLabel
    Tile.prototype.setWordLabel = function (str) {
        this.wordLabel.string = str;
    };
    // 添加监听事件
    Tile.prototype.addListener = function (fn, target) {
        this.node.on(cc.Node.EventType.TOUCH_END, fn, target);
    };
    // 移除监听事件
    Tile.prototype.removeListener = function (fn, target) {
        this.node.off(cc.Node.EventType.TOUCH_END, fn, target);
    };
    __decorate([
        property(cc.Sprite)
    ], Tile.prototype, "bgSprite", void 0);
    __decorate([
        property(cc.Label)
    ], Tile.prototype, "wordLabel", void 0);
    __decorate([
        property({
            type: cc.SpriteFrame,
        })
    ], Tile.prototype, "tile_bg", void 0);
    __decorate([
        property({
            type: cc.SpriteFrame,
        })
    ], Tile.prototype, "tile_bg_normal", void 0);
    __decorate([
        property({
            type: cc.SpriteFrame,
        })
    ], Tile.prototype, "tile_bg_selected", void 0);
    __decorate([
        property({
            type: cc.SpriteFrame,
        })
    ], Tile.prototype, "tile_bg_success", void 0);
    __decorate([
        property({
            type: cc.SpriteFrame,
        })
    ], Tile.prototype, "tile_bg_normal2", void 0);
    __decorate([
        property({
            type: cc.SpriteFrame,
        })
    ], Tile.prototype, "tile_select_bg", void 0);
    Tile = __decorate([
        ccclass
    ], Tile);
    return Tile;
}(cc.Component));
exports.Tile = Tile;

cc._RF.pop();